<%--
  Created by IntelliJ IDEA.
  User: 飞蓬
  Date: 2018/4/26
  Time: 19:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">
    <jsp:include page="../js_top.jsp"/>
    <link href="<%=basePath%>/static/css/css.css" rel="stylesheet" type="text/css"/>
    <style type="text/css">
        /* 分页ul中的li样式 */
        .pagination ul {
            margin: 2px 10px 0;
            list-style: none; /* 去掉ul前面的符号 */
        }

        .pagination ul li {
            float: left; /* 向左漂移，将竖排变为横排 */
        }

        .pagination ul > li > a, .pager > li > a {
            background: none;
            color: #63666d;
            padding: 4px 8px;
            font-family: Arial, Verdana, "微软雅黑";
            font-size: 14px;
            cursor: pointer;
        }

        .pagination ul > li > a:hover {
            background: none;
        }

        .pagination ul > li > a:hover, .pager > li > a:hover {
            color: #0fb1d6;
            text-decoration: underline;
        }

        .pagination ul input {
            height: 23px;
            margin-top: 1.5px;
        }

        .tab {
            width: auto;
            height: 26px;
            float: right;
            margin: 7px 13px 0 0;
        }

        .tab a {
            width: 24px;
            height: 24px;
            line-height: 24px;
            text-align: center;
            display: block;
            float: left;
            background: #eff3f5;
            border: 1px solid #9fa3a8;
            border-radius: 5px;
            color: #727a85;
            font-size: 14px;
            font-family: Arial, Verdana;
            font-weight: 700;
            cursor: pointer;
        }

        .tab a.active, .mms_vip_tab a:hover {
            color: #fff;
            border: 1px solid #596066;
        }

        .tab a:not (:last-child ) {
            margin: 0 13px 0 0;
        }

        .tab a:first-child {
            background: url(/static/img/images/mms_vip_icon.png) no-repeat;
        }

        .tab a:first-child:hover {
            background: #727a85 url(/static/img/images/mms_vip_icon1.png) no-repeat;
        }

        .tab a:nth-child(2) {
            background: url(/static/img/images/mms_vip_icon.png) no-repeat 0px -24px;
        }

        .tab a:nth-child(2):hover {
            background: #727a85 url(/static/img/images/mms_vip_icon1.png) no-repeat 0px -24px;
        }

        .tab a:nth-child(3) {
            background: url(/static/img/images/mms_vip_icon.png) no-repeat 0px -48px;
        }

        .tab a:nth-child(3):hover {
            background: #727a85 url(/static/img/images/mms_vip_icon1.png) no-repeat 0px -48px;
        }

        .tab a:nth-child(4) {
            background: url(/static/img/images/source_management_tab.png) no-repeat 0px 0px;
        }

        .tab a::nth-child(4):hover {
            background: #727a85 url(/static/img/images/source_management_tab.png) no-repeat 0px -24px;
        }

        .tab a:not(:last-child) {
            margin: 0 13px 0 0;
        }


    </style>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="userList">
    <title>挂号单列表</title>
</head>
<body>


<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <br>
            <!-- 检索  -->
            <form action="/hs/order/orderList.do?userId=${order.userId}" method="post" name="form1" id="form1">
                <div style="float: left;">
                    <div class="alarm_set_tab" style="margin-top: 10px">
                        <span>预约医院</span>
                        <input type="text" id="hospitalname" name="hospitalname" value="${order.hospitalname}"
                               style="width:130px" placeholder="请输入医院名称...">
                        <span style="margin-left: 10px">预约科室</span>
                        <input type="text" id="departmentname" name="departmentname" value="${order.departmentname}"
                               style="width:130px" placeholder="请输入科室名称...">
                        <span style="margin-left: 10px">预约日期</span>
                        <input type="text" id="visitdate" name="visitdate" value="${order.visitdate}" class="Wdate"
                               onFocus="javascript:WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd',minDate:'%y-%M-%d'})"
                               style="font-size: 14px; font-family: 微软雅黑, 宋体, 黑体;width: 180px;height:30px;margin-bottom:0px;"/>
                        <a href="javascript:search();" style="margin-left: 10px;">查询</a>
                    </div>
                </div>
                <div style="float: left;">
                    <div style="font-size: 18px;font-family: 微软雅黑, 宋体, 黑体;background:url(<%=basePath%>/static/img/images/right_main_tab1.png) repeat-x center bottom;width:100%;height:51px;border-radius: 5px 5px 0px 0px;border:1px solid #c4cdd8;border-bottom:0px solid #FFFFFF;">
                        <span style="line-height:51px; margin-left:15px;">挂号单列表</span>
                        <div style="margin-top:10px;float:right;" class="tab">
                            <a title="新增" href="javascript:add();"></a>
                            <a title="删除" href="javascript:del();"></a>
                            <a title="编辑" href="javascript:update();"></a>
                        </div>
                    </div>
                    <div style="width:100%; border:1px solid #c4cdd8">
                        <table class="table table-bordered table-striped table-hover"
                               style="margin-left: 10px;margin-top: 10px; width: 750px">
                            <thead>
                            <tr>
                                <th>预约医院</th>
                                <th>预约科室</th>
                                <th>预约医生</th>
                                <th>预约日期</th>
                                <th>预约开始时间</th>
                                <th>预约结束时间</th>
                                <th>是否有效</th>
                                <th>评分</th>
                                <th>评价</th>
                                <th>实际就诊时间(小时)</th>
                            </tr>
                            </thead>
                            <tbody>
                            <c:choose>
                                <c:when test="${not empty page.result}">
                                    <c:forEach items="${page.result}" var="od" varStatus="vs">
                                        <tr id="tr${vs.count}" onclick="trOnclick('tr${vs.count}','${od.id}','${od.timelineId}','${od.visitdate}');">
                                            <td>${od.hospitalname}</td>
                                            <td>${od.departmentname}</td>
                                            <td>${od.doctorname}</td>
                                            <td>${od.visitdate}</td>
                                            <td>${od.visitstarttime}</td>
                                            <td>${od.visitendtime}</td>
                                            <td>${od.visitstatus == 1?"有效":"无效"}</td>
                                            <td>${od.score}</td>
                                            <td>${od.evaluate}</td>
                                            <td>${od.diagnosetime}</td>
                                        </tr>
                                    </c:forEach>
                                </c:when>
                                <c:when test="${empty page.result}">
                                    <tr>
                                        <td colspan="10" style="color: red;">暂无数据!</td>
                                    </tr>
                                </c:when>
                            </c:choose>
                            </tbody>
                        </table>

                        <div class="pagination" style="float: right; padding-top: 0px; margin-top: 5px;height: 34px;">
                            ${page.pageStrLess}
                        </div>


                    </div>
                </div>
            </form>
        </div>

    </div>
</div>
</body>


<script type="text/javascript">
    //鼠标点过高亮取到相关数据
    var tempClassId = "";
    var tridClick = "";
    var idClick = "";
    var timelineidClick = "";
    var visitdateClick = "";
    function trOnclick(tridTemp, idTemp,timelineidTemp,visitdateTemp) {
        tridClick = tridTemp;
        idClick = idTemp;
        timelineidClick = timelineidTemp;
        visitdateClick = visitdateTemp;
        $("#" + tridTemp).attr('class', 'info');
        if (tempClassId != "" && tempClassId != tridTemp) {
            $("#" + tempClassId).attr("class", "");
        }
        tempClassId = tridTemp;
    }

    function search() {
        $('#form1').submit();
    }
    function add() {
        var diag = new top.Dialog();
        diag.Title = "新增";
        diag.URL = '<%=basePath%>hs/order/turnSave.do?userId=${order.userId}';//跳转页面函数
        diag.Top = "50%";
        diag.Left = "30%";
        diag.Width = 580;
        diag.Height = 380;
        diag.CancelEvent = function () {
            diag.close();
            search();
            nextPage(${page.currentPage});
        };
        diag.show();
    }
    function update() {
        if (idClick == '') {
            layer.msg('请选择数据后再编辑！！');
            return false;
        }
        var diag = new top.Dialog();

        if(compareDate(visitdateClick,getNowFormatDate())) {
            diag.Title = "编辑";
            diag.URL = '<%=basePath%>hs/order/turnSave.do?id=' + idClick;
            diag.Width = 580;
            diag.Height = 380;
        }else{
            diag.Title = "评价";
            diag.URL = '<%=basePath%>hs/order/feedback.do?id=' + idClick;
            diag.Width = 580;
            diag.Height = 280;
        }
        diag.Top = "50%";
        diag.Left = "30%";
        diag.CancelEvent = function () {
            diag.close();
            nextPage(${page.currentPage});
        };
        diag.show();
    }

    function del() {
        if (idClick == '') {
            layer.msg('请选择数据后再删除！！');
            return false;
        }
        layer.confirm('确定要删除吗？', {
            btn: ['确定', '取消'],
            title: '删除'
        }, function () {
            var url = '<%=basePath%>hs/order/delete.do?id=' + idClick+'&timelineId='+timelineidClick;
            $.get(url, function (data) {
                nextPage(${page.currentPage});
            });
        })

    }
    //获取当前时间，格式YYYY-MM-DD
    function getNowFormatDate() {
        var date = new Date();
        var seperator1 = "-";
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var strDate = date.getDate();
        if (month >= 1 && month <= 9) {
            month = "0" + month;
        }
        if (strDate >= 0 && strDate <= 9) {
            strDate = "0" + strDate;
        }
        var currentdate = year + seperator1 + month + seperator1 + strDate;
        return currentdate;
    }

    //比较日期大小
    function compareDate(date1, date2) {
        var date1 = new Date(date1);
        var date2 = new Date(date2);
        if (date1.getTime() >= date2.getTime()) {
            return true;
        } else {
            return false;
        }
    }

</script>
</html>
